package babymall.controller;

import javax.annotation.Resource;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import babymall.model.Admin;
import babymall.model.AdminDTO;
import babymall.service.IAdminService;

@RestController
@RequestMapping("admin")
public class AdminController {

	@Resource
	private IAdminService service;
	
	@RequestMapping("login.do")
	public Admin login(Admin a) {
		//登录信息存在session中
		return 	service.login(a);
	}
	
	@RequestMapping("add.do")
	public int add(Admin a) {
		return service.add(a);
	}
	
	@RequestMapping("edit.do")
	public int edit(Admin a) {
		return service.edit(a);
	}
	
	@RequestMapping("del.do")
	public int del(Integer id) {
		return service.del(id);
	}
	
	@RequestMapping("editPwd.do")
	public int editPwd(AdminDTO dto) {
		return service.editPwd(dto);
	}
	
}
